package com.lzxuni.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lzxuni.mapper.SheBeiMapper;
import com.lzxuni.po.QxData;
import com.lzxuni.po.QxDataCostom;
import com.lzxuni.po.SheBei;
import com.lzxuni.po.YongHuCustom;
import com.lzxuni.service.SheBeiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;

@Service("sheBeiService")
public class SheBeiServiceImpl implements SheBeiService {

    @Autowired
    private SheBeiMapper sheBeiMapper ;

    @Override
    public List<SheBei> findList() throws Exception  {
        return sheBeiMapper.findList();
    }


    @Override
    public void addSheBei(SheBei demo) throws Exception  {
        sheBeiMapper.addSheBei(demo);
    }

    @Override
    public void updateSheBeiLastTime(String userkey) throws Exception  {
        sheBeiMapper.updateSheBeiLastTime(userkey);
    }
    @Override
    public void updateSheBeiuserName(SheBei demo) throws Exception  {
        sheBeiMapper.updateSheBeiuserName(demo);
    }

    @Override
    public List<SheBei> findSheBei(String tableName) throws Exception  {
        return sheBeiMapper.findSheBei(tableName);
    }

    @Override
    public PageInfo<?> findShebeiList(int pageNumber, int pageSize, SheBei demo) throws Exception {
        PageHelper.startPage(pageNumber, pageSize).setOrderBy("createTime desc");
        List<SheBei> list = sheBeiMapper.findList();
        PageInfo pageInfo = new PageInfo(list);
        return pageInfo;
    }

    @Override
    public SheBei findSheBeiById(String userkey) throws Exception {

        return sheBeiMapper.findSheBeiById(userkey);
    }


    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    public PageInfo<?> findqxsjBytableName(int pageNumber, int pageSize, String tableName) throws Exception {
        PageHelper.startPage(pageNumber, pageSize).setOrderBy("createTime desc");
        List<QxData> list = sheBeiMapper.findqxsjBytableName(tableName);

        PageInfo pageInfo = new PageInfo(list);
        return pageInfo;
    }

    @Override
    public List<QxDataCostom> findqxsjlist(QxDataCostom demo) throws Exception  {
        return sheBeiMapper.findqxsjlist(demo);
    }
    @Override
    public List<QxDataCostom> findqxsjone(QxDataCostom demo) throws Exception  {
        return sheBeiMapper.findqxsjlist(demo);
    }


}
